package com.hh.springboot.service.impl;

import com.hh.springboot.mapper.ShopCartMapper;
import com.hh.springboot.model.ShopCart;
import com.hh.springboot.service.ShopCartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShopCartServiceImpl implements ShopCartService {
    @Autowired
    private ShopCartMapper shopCartMapper;

    @Override
    public List<ShopCart> getShopCarts(int uId) {
        return shopCartMapper.getShopCarts(uId);
    }

    @Override
    public int insertShopCart(ShopCart shopCart) {
        return shopCartMapper.insertShopCart(shopCart);
    }

    @Override
    public int updateShopCart(ShopCart shopCart) {
        return shopCartMapper.updateShopCart(shopCart);
    }

    @Override
    public int deleteShopCart(int id) {
        return shopCartMapper.deleteByPrimaryKey(id);
    }

    @Override
    public ShopCart getShopCart(int commodityId, int uId) {
        return shopCartMapper.getShopCart(commodityId, uId);
    }
}
